package com.zbkj.dal.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum EmployeeStatusEnum {

    ENABLE("ENABLE", "启用"),
    DISABLE("DISABLE", "禁用"),
    ;
    private final String code;
    private final String desc;

    public static String getDescByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        return Arrays.stream(EmployeeStatusEnum.values()).filter(e -> Objects.equals(e.getCode(), code)).map(EmployeeStatusEnum::getDesc).findFirst().orElse(null);
    }
}
